import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
public class bstrings {
    public static void main (String[] args) throws IOException{
        if (args.length<1) throw new RuntimeException ("not enough arguments");
        if (args.length>1) throw new RuntimeException ("too many arguments");
        BufferedReader reader = new BufferedReader (new FileReader (new File (args[0])));
        String line;
        while ((line = reader.readLine()) != null){          
           line = line.toLowerCase().replaceAll("[^a-z]", "");
           HashMap<Character,Integer> map = new HashMap<Character,Integer>();
           int count = 1;
           for (int i = 0;i<line.length();i++){
               char c = line.charAt(i);
               Integer val = map.get(c);
               if (val != null) {
                   count = map.get(c) + 1;
                   map.put(c, count);
               }else{
                   count = 1;
                   map.put(c, 1);
               }
           }
           Object[] freq = map.values().toArray();
           Arrays.sort(freq);
           Integer[] fInt = new Integer[freq.length];
           for (int i = 0;i<freq.length;i++){
               fInt[i] = Integer.parseInt(freq[i].toString());
           }  
           int maxBeauty = 0;
           int max = 26;
           for (int i = freq.length-1;i>=0;i--){
               maxBeauty = maxBeauty + max*fInt[i];
               max--;
           }     
           System.out.println(maxBeauty);
           
        }
    }
}